using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using LitJson;

namespace KBE_HotFix.Config
{
    public class ConfigLoadHelper
    {
        public static void Load(string clsName, string data, bool isArray)
        {
            var mgrType = Type.GetType(NamespacePrefix.Config + clsName + "Manager");
            if (mgrType == null)
            {
                string msg = "Cant find ManageClass :" + clsName;
                KBEngine.Dbg.ERROR_MSG(msg);
                return;
            }
            var methodInfo = mgrType.BaseType.GetMethod("Load");//.First(m => m.Name == "Load" && m.IsGenericMethodDefinition);
            var jsonData = JsonMapper.ToObject(data);
            methodInfo.Invoke(null, new object[] { jsonData, isArray });
        }
    }
}